﻿Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.IO
Imports HTLibrary
Imports TNCDAL

Public Class frmUpdateSoftware

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowser.Click
        'mo form cho nguoi ta chon co so du lieu
        OpenFileDialog1.Filter = "Backup File(*.txt;*.sql)|*.txt;*.sql|All files (*.*)|*.*"
        OpenFileDialog1.ShowDialog()
        txtFilePath.Text = OpenFileDialog1.FileName
        Dim readText As String = File.ReadAllText(txtFilePath.Text, Encoding.UTF8)
        richTextBoxNoiDung.Text = readText
    End Sub

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
        If (File.Exists(txtFilePath.Text)) Then
            CollectionHelper.ExecSql_FromScriptFile(GeneralClassDAL.dc.Connection.ConnectionString, txtFilePath.Text)
            MessageBox.Show("Cập nhật xong!")
        End If
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
End Class